Skip to content

Workflow Artifact Info Hover#37100

Draft
bircni wants to merge 14 commits intogo-gitea:mainfrom
bircni:feature/add-artifact-expiry-hover
Draft

Workflow Artifact Info Hover#37100
bircni wants to merge 14 commits intogo-gitea:mainfrom
bircni:feature/add-artifact-expiry-hover

Conversation

@bircni
Copy link
Copy Markdown
Member

@bircni bircni commented Apr 3, 2026

Add expiry metadata to action artifacts in the run view and show it on hover.

grafik

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 3, 2026
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Apr 3, 2026
@bircni bircni changed the title restart Workflow Artifact Info Hover Apr 3, 2026
@bircni bircni force-pushed the feature/add-artifact-expiry-hover branch from aee7bce to 9c7e067 Compare April 3, 2026 21:51
@bircni bircni force-pushed the feature/add-artifact-expiry-hover branch from 9c7e067 to 5d9a44e Compare April 3, 2026 21:53
@silverwind
Copy link
Copy Markdown
Member

Can you add the hover over the actual link, not the parent div? That way the triangle of the tooltip should be aligned correctly and not point to nothing.

@bircni
Copy link
Copy Markdown
Member Author

bircni commented Apr 4, 2026

Can you add the hover over the actual link, not the parent div? That way the triangle of the tooltip should be aligned correctly and not point to nothing.

I tried, it is currently at the link but it somehow doesnt work - Could you help me? @silverwind

@silverwind
Copy link
Copy Markdown
Member

silverwind commented Apr 4, 2026

I think you can just produce the <relative-time> element in JS. tippy is capable of HTML tooltip content via an option, called html=true iirc.

@bircni bircni requested a review from silverwind April 6, 2026 10:26
silverwind and others added 2 commits April 9, 2026 21:01
- Use relative-time element for date formatting in tooltip
- Extract formatFileSize to shared utility web_src/js/utils/size.ts
- Remove custom Intl.DateTimeFormat, ArtifactTooltipLocale type, Size label
- Use createTippy with DOM element content via ref callback
- Use muted link style for active artifacts, faded style for expired
- Add semibold to sidebar section headings
- Skip tooltip on expired artifacts
- Disable tooltip arrow, use top-end placement

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member

Did a number of tweaks and fixes, now using relative-time:

Screenshot 2026-04-09 at 22 07 05

Move vertical padding from li to first-child so the link covers
the full row height. Reduce tooltip offset to 2px.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member

silverwind commented Apr 9, 2026

Also one notable change: Expired artifacts don't show a tooltip. I noticed the DB apparently stores the size of expired artifacts but imho it's a rarely useful and confusing info to display size of a expired artifact.

Also backport as a no-risk enhancement.

- Move formatBytes (renamed from formatFileSize) into web_src/js/utils.ts
- Remove web_src/js/utils/size.ts
- Move artifact li padding to first-child for full-height click area
- Reduce tooltip offset to 2px

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind silverwind requested a review from Copilot April 9, 2026 20:19
@silverwind silverwind added the backport/v1.26 This PR should be backported to Gitea 1.26 label Apr 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds artifact expiry metadata (and size) to the Actions run view and displays it as a hover tooltip in the sidebar artifact list, backed by new backend fields and frontend formatting helpers.

Changes:

  • Extend backend artifact metadata to include expired_unix and expose it as expiresUnix in the actions run view response.
  • Add frontend tooltip generation for artifacts (expiry via <relative-time> + formatted size).
  • Introduce a shared formatBytes() utility and corresponding unit tests; add new locale key for “Expires at %s”.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
web_src/js/utils.ts Adds formatBytes() helper for human-readable artifact sizes.
web_src/js/utils.test.ts Adds unit tests for formatBytes().
web_src/js/modules/gitea-actions.ts Extends ActionsArtifact type with size and expiresUnix.
web_src/js/features/repo-actions.ts Wires new locale string (artifactExpiresAt) into the Vue view props.
web_src/js/components/RepoActionView.vue Attaches artifact hover tooltips and adjusts artifact list styling.
web_src/js/components/ActionRunArtifacts.ts Implements tooltip element creation (expiry + size).
web_src/js/components/ActionRunArtifacts.test.ts Adds unit tests for tooltip element creation.
templates/repo/actions/view_component.tmpl Adds data-locale-artifact-expires-at for the run view.
templates/devtest/relative-time.tmpl Adds a devtest example including minute-level formatting.
routers/web/repo/actions/view.go Adds expiresUnix to artifacts JSON returned by the run view endpoint.
routers/web/devtest/mock_actions.go Populates mock artifacts with ExpiresUnix values for devtest.
options/locale/locale_en-US.json Adds artifact_expires_at locale string.
models/actions/artifact.go Includes expired_unix in grouped artifact meta query results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

silverwind and others added 3 commits April 9, 2026 22:31
- encodeURIComponent on artifact download href for names with
  spaces or special characters
- Use minute='2-digit' on relative-time for consistent zero-padding

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
- Replace text pipe with border-left separator via Tailwind classes
- Remove flexbox on tooltip container to preserve whitespace
  between locale text and relative-time element
- Fix empty line at end of style block

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind silverwind force-pushed the feature/add-artifact-expiry-hover branch from b6c8792 to 3887aaf Compare April 9, 2026 20:44
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind silverwind marked this pull request as ready for review April 9, 2026 20:45
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 9, 2026
@silverwind
Copy link
Copy Markdown
Member

Latest screenshot:

image

@bircni bircni requested a review from wxiaoguang April 9, 2026 21:25
@bircni
Copy link
Copy Markdown
Member Author

bircni commented Apr 9, 2026

thanks for your help @silverwind

silverwind and others added 2 commits April 9, 2026 23:49
…sion

Replace loop-based byte formatting with log-based approach. The function
now accepts suffix and precision options, defaulting to byte formatting
with IEC binary units (KiB, MiB, GiB).

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Replace loop-based division with log2-based exponent calculation.
Add precision parameter for configurable significant digits.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member

some minor refactors done to formatBytes, now log-based, output is same as before.

Comment on lines +27 to +34
function initSidebarTooltip(el: HTMLElement | null, content: string | HTMLElement) {
if (!el) return;
if (el._tippy) {
el._tippy.setContent(content);
} else {
createTippy(el, {content, role: 'tooltip', theme: 'tooltip', placement: 'top-end', arrow: false, offset: [0, 2]});
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to improve the framework, instead of making future developers copy&paste such code.

For example: data-tooltip-render-html="true"

Copy link
Copy Markdown
Member

@silverwind silverwind Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess some generic way to specify all tippy props in HTML is needed. Should be done with a future migration to https://github.com/floating-ui/floating-ui in mind.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess some generic way to specify all tippy props in HTML is needed.

No, don't do more than it needs.

"tooltip" is "tooltip". Other tippy popups don't use "tooltip-content" for content.

@silverwind silverwind self-requested a review April 9, 2026 23:43
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 9, 2026
@silverwind
Copy link
Copy Markdown
Member

I see a few more refactor opportunities, will do later.

@wxiaoguang wxiaoguang removed the backport/v1.26 This PR should be backported to Gitea 1.26 label Apr 10, 2026
@wxiaoguang wxiaoguang marked this pull request as draft April 10, 2026 04:44
Comment on lines +274 to +283
.action-view-left .ui.relaxed.list > .item {
padding-top: 0;
padding-bottom: 0;
}

.action-view-left .ui.relaxed.list > .item > :first-child {
padding-top: 0.42857143em;
padding-bottom: 0.42857143em;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, don't use such trick. You can see it breaks the UI , makes the "job list" very narrow.

Copy link
Copy Markdown
Member

@silverwind silverwind Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor fix to have the full vertical area hoverable (e.g. link turns blue on .item mouseenter), but I think it needs a cleaner solution. In my testing, visually there was no difference, padding just moved from .item to .item > a.

Will check. Likely refactor to a.item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants